 <script th:inline="javascript">
/*<![CDATA[*/

    function del(event,element){
        event.preventDefault();
          bootbox.confirm("删除此类型会同时删除此类型下的所有优惠券,您确定删除吗?", function(result) {
        if(result){
            var _id = $(element).attr("href").split("_")[0];
            var _page=$(element).attr("href").split("_")[1];
            var _viewState = $(element).attr("href").split('_')[2];
            BOSS.remoteCall('promotion/coupon/delete',$('#couponPromotion_grid'),{couponPromotionId:_id,page:_page,viewState:_viewState});
            }
        }); 
    }
    
/*]]>*/
</script>
<table layout:fragment="couponpromotion_table" class="table table-striped table-bordered  table-advance table-hover" id="couponPromotion_grid">
    <thead>
        <tr>
            <th>编号</th>
            <th>类型名称</th>
            <th>发放类型</th>
            <th>优惠卷金额</th>
            <th>订单下限</th>
            <th>发放数量</th>
            <th>使用数量</th>
            <th>操作</th>
        </tr>
    </thead>    
    <tbody>
        <tr class="odd gradeX" th:each="data : ${couponPromotionPage}">
            <td th:text="${data.id}">
                 编号
            </td>
            <td th:utext="|${data.name} ${data.status}|">
                 name
            </td>
            <td th:text="${data.grantType.description}">
                 按XX发放
            </td>
            <td th:text="${data.bonusPrice}">
            </td>
            <td th:text="${data.limitPrice}">
            </td>
            <td th:text="${data.grantNum}">
            </td>
            <td th:text="${data.usedNum}">
            </td>
            <td>
                <a th:if="${data.grantNum} > 0" th:attr="id=${'link_export_'+dataStat.index}" th:href="@{'/promotion/coupon/export/'}+${data.id}">报表</a>
                <span th:unless="${data.grantNum} > 0">报表</span>
                <span th:switch="${data.grantType.description}">
                    <span th:case="按用户发放"><a th:attr="id=${'link_grant_'+dataStat.index}" href="#" th:href="@{'/promotion/coupon/grant/'}+${data.id}">发放</a></span>
                    <span th:case="线下发放"><a th:attr="id=${'link_grant_'+dataStat.index}" href="#" th:href="@{'/promotion/coupon/grant/'}+${data.id}">发放</a></span>
                    <span th:case="*">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                </span>
                <a th:if="${data.grantNum} > 0" th:attr="id=${'link_view_'+dataStat.index}" th:href="@{'/promotion/coupon/view/index/'}+${data.id}">查看</a>
                <span th:unless="${data.grantNum} > 0">查看</span>
                <a th:attr="id=${'link_edit_'+dataStat.index}" href="#" th:href="@{'/promotion/coupon/edit/'+${data.id}}">编辑</a>
                <a th:attr="id=${'link_delete_'+dataStat.index}" th:href="${data.id}+'_'+${couponPromotionPage.number}+'_'+${viewState}" onclick="del(event,this)">移除</a>
            </td>         
        </tr>
        <tr >
			<td colspan="12" align="center" th:if="${couponPromotionPage.getNumberOfElements() == 0}" >未查到任何记录，请放大查询条件试试</td>
		</tr>
     </tbody>
</table>



